/*
  AeroQuad v2.4 - April 2011
  www.AeroQuad.com
  Copyright (c) 2011 Ted Carancho.  All rights reserved.
  An Open Source Arduino based multicopter.
 
  This program is free software: you can redistribute it and/or modify 
  it under the terms of the GNU General Public License as published by 
  the Free Software Foundation, either version 3 of the License, or 
  (at your option) any later version. 

  This program is distributed in the hope that it will be useful, 
  but WITHOUT ANY WARRANTY; without even the implied warranty of 
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 
  GNU General Public License for more details. 

  You should have received a copy of the GNU General Public License 
  along with this program. If not, see <http://www.gnu.org/licenses/>. 
*/

/**************************************************************/
/************************** GPS *******************************/
/**************************************************************/
// This is experimental, it is not yet functional

#ifdef FEAT_GPS

class UBloxGps {
    private:
        long GPSTime;
        long GPSFix;
        long GPSLat;
        long GPSLong;
        long GPSAlt;
        long GPSGSpeed;
        long GPSGCourse;
        
    public:
        UBloxGps() {
            GPSTime = 0;
            GPSFix = 0;
            GPSLat = 0;
            GPSLong = 0;
            GPSAlt = 0;
            GPSGSpeed = 0;
            GPSGCourse = 0;
        }
  
        void Initialize() {
            GPS.Init();
            delay(1000);   //Add the delay so that the GPS gets enough time to stabilize and initialize
        }
    
        void Read()  {
            GPS.Read();
            if (GPS.NewData)  // New GPS data?
            {
                GPSTime = GPS.Time;
                GPSFix = GPS.Fix;
                GPSLat = GPS.Lattitude;
                GPSLong = GPS.Longitude;
                GPSAlt = GPS.Altitude;
                GPSGSpeed = GPS.Ground_Speed;
                GPSGCourse = GPS.Ground_Course;
                GPS.NewData = 0; // We have readed the data
            }
        }


        
        long GetTime()  {
            return GPSTime;
        }
        
        long GetFix() {
            return GPSFix;
        }
        
        long GetLat() {
            return GPSLat;
        }
        
        long GetLong() {
            return GPSLong;
        }
        
        long GetAlt() {
            return GPSAlt;
        }

        long GetGSpeed() {
            return GPSGSpeed;
        }

        long GetGCourse() {
            return GPSGCourse;
        }
};
#endif



